#include "UDP_server.hpp"
#include "dict.hpp"

void Usage(char* argv[])
{
    //printf("%s\n\t[IP] [Port]", argv[0]);
    printf("%s\n\t[Port]", argv[0]);

}
int main(int argc, char* argv[])
{
    //if (argc != 3)
    if (argc != 2)
    {
        Usage(argv);
        exit(1);
    }

    uint16_t port = std::stoi(argv[1]);    //端口号
    //std::string ip = argv[1];               //IP地址

    Dict d(DICT_DEFAULT_PATH);

    UDPEchoServer server(port, std::bind(&Dict::translate, &d, std::placeholders::_1));
    //UDPEchoServer server(port, ip);

    server.ServerInit();
    server.ServerStart();

    return 0;
}